package TangramCore;

public class Point2D extends java.awt.geom.Point2D.Double {
	static final long serialVersionUID = 24362462L;
	
	public Point2D() {
        super();
    }

    public Point2D(double x, double y){
        super(x, y);
    }

    public Point2D(Point2D p){
        this(p.x, p.y);
    }

    public void copyFrom(Point2D p){
        setLocation(p);
    }

    public void translate(double dx, double dy){
        setLocation(x + dx, y + dy);
    }

    public void translate(Point2D p){
        setLocation(x + p.x, y + p.y);
    }

    public void rotate(double px, double py, double a){
        double dx = x - px;
        double dy = y - py;
        double cosa = Math.cos(a);
        double sina = Math.sin(a);
        setLocation(dx * cosa - dy * sina + px, dx * sina + dy * cosa + py);
    }

    public void rotate(Point2D p, double a){
        rotate(p.x, p.y, a);
    }

    public void rotate(double a){
        rotate(0, 0, a);
    }

}
